<template>
  <popup :show.sync="show">
    <div class="order-form">
      <h2>报名信息<icon id="close" @click.native="hide"></icon></h2>
      <div class="order-form-item">
        <h3>姓名</h3>
        <input type="text" v-model="name" placeholder="请填写真实姓名">
      </div>
      <div class="order-form-item">
        <h3>手机</h3>
        <input type="tel" v-model="tel" placeholder="请填写手机号">
      </div>
      <a class="btn btn-primary" :disabled="!(name && tel)" @click="submit">提交</a>
    </div>
  </popup>
</template>

<script>
export default {
  data () {
    return {
      show: 0,

      name: '',
      tel: ''
    }
  },
  methods: {
    hide () {
      this.show = 0
    },
    submit () {
      const { name, tel } = this

      this.$emit('submit', { name, tel })
    }
  }
}
</script>

<style lang="scss" scoped>
.order-form {
  background: $bg;

  > h2 {
    margin: 0;
    line-height: 1;
    padding: 16px 10px;
    font-size: 16px;
    font-weight: 400;
    border-bottom: 1px solid $border-color;

    > .icon {
      float: right;
    }
  }

  &-item {
    margin: 10px 0 0 10px;

    &:not(:last-of-type) {
      border-bottom: 1px solid $border-color;
    }

    > h3 {
      margin: 0;
      line-height: 1;
      font-size: 14px;
      font-weight: 400;
    }

    > input {
      padding: 10px 0;
      font-size: 12px;
      -webkit-appearance: none;
      border: 0;
      width: 100%;
    }
  }

  >.btn {
    border: 0;
    border-radius: 0;
  }
}
</style>

